package hibernate;

import java.io.Serializable;
import java.util.List;

import org.hibernate.criterion.DetachedCriteria;

public interface IDao {
	
	
	public Integer findInt(String hql, Object... args);
	public Long findLong(String hql, Object... values);
	public String findString(String hql, Object... values);
	
	public Object findFirst(String hql, Object... args);
	
	public <E> E findFirst(Class<E> clasz, String order,String cond, Object[] args,String... includes);
	public <E> E findFirst(Class<E> clasz, String orderBy,Boolean isAsc,String sqlRestriction, String... includes);
	
	public List findAll(String hql, Object... args);
	public List findAll(Class clasz, String order, String cond,Object[] args, String... includes);
	
	public <E> E getById(Class<E> clasz, Serializable id,String... includes);
	public <E> E getByProperty(Class<E> clasz, String name,Object value,String... includes);
	
	public List findByCriteria(DetachedCriteria dc);
	public List findByCriteria(DetachedCriteria dc,int start,int limit);
	public Page findPage(DetachedCriteria dc,int start,int limit);
	public Page findPage(DetachedCriteria dc, int start,int limit,String... includes);
	public Page findPageBySQL(String sql, Object[] args, int start,int limit);
	public Page findPageByHQL(String hql, Object[] args, int start,int limit);
	
	public void save(Object entity);
	public void update(Object entity);
	public void saveOrUpdate(Object entity);
	public void saveOrUpdateAll(List<?> list);
	public void delete(Object entity);
	public int delete(Class clazz,Object[] ids);
	public int delete(Class clasz,Object id);
	
	public int executeUpdate(String executeHQL, Object... values);
	
	public void down(Class mappingClass,Integer id,String groupBy);
	public void up(Class mappingClass,Integer id,String groupBy);
	
	public Object getMax(Class entityClass,String propertyName,String scope,Object value);
	public Object getMin(Class entityClass,String propertyName,String scope,Object value);
	public boolean isExist(Class<?> classname, String property, Object value, String whereClause, Object[] values);
	
}
